<template>
	<view>
		<u-rate @change="rateChange" :disabled="disabled || !writable" v-model="val"></u-rate>
	</view>
</template>

<script>
export default {
	data() {
		return {
			val: '',
			validator: false
		};
	},
	props: {
		value: {
			type: Number,
			default: 0
		},
		disabled: {
			type: Boolean,
			default: false
		},
		writable: {
			type: Boolean,
			default: true
		}
	},
	watch: {
		value: {
			handler () {
				this.val = this.value || ''
			},
			immediate: true,
			deep: true
		}
	},
	methods: {
		rateChange(e) {
			this.$emit('input', e)
		},
	}
}
</script>

<style scoped>
.requiredMessage {
	width: 100%;
	height: 50rpx;
	line-height: 50rpx;
	color: #f56c6c;
	font-size: 22rpx;
}
</style>